package tld.test.menu
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import tld.test.interpreter.runtime.Runtime;
	import tld.test.menu.challenges.ChallengeTheChallenge;
	
	public class MainTest extends Sprite
	{
		public function MainTest()
		{
			super();
			if (super.stage) this.init();
			else super.addEventListener(
				Event.ADDED_TO_STAGE, this.init);
		}
		
		private function init(event:Event = null):void
		{
			var challenge:ChallengeTheChallenge = 
				new ChallengeTheChallenge();
			var runtime:Runtime = new Runtime();
			var console:Console = new Console(runtime);
			
			super.removeEventListener(
				Event.ADDED_TO_STAGE, this.init);
			super.stage.scaleMode = StageScaleMode.NO_SCALE;
			super.stage.align = StageAlign.TOP_LEFT;
			console.width = super.stage.stageWidth;
			console.height = 300;
			super.addChild(console);
			challenge.y = 300;
			super.addChild(challenge);
			challenge.setConsole(console);
			challenge.setRuntime(runtime);
		}
	}
}